package transaction.seata.account.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;
import tk.mybatis.springboot.util.MyMapper;
import transaction.seata.account.model.AccountTbl;

@Repository
public interface AccountTblMapper extends MyMapper<AccountTbl> {

    @Update("UPDATE account_tbl SET money = money-#{num} WHERE id=#{id} AND money-#{num}>=0")
    int updateByPrimaryKeySelectiveNew(@Param("id") Integer id, @Param("num") Integer num);
}